.class public Lcom/donson/momark/util/b/a;
.super Ljava/lang/Thread;


# static fields
.field private static b:Lcom/donson/momark/util/b/a;

.field private static j:Ljava/util/Map;


# instance fields
.field a:Landroid/app/KeyguardManager;

.field d:Landroid/app/ActivityManager;

.field private e:Landroid/content/Context;

.field private g:Lcom/donson/momark/a/r;

.field private h:Lcom/donson/momark/view/view/AdView;

.field private w:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/donson/momark/util/b/a;->j:Ljava/util/Map;

    return-void
.end method

.method private constructor <init>()V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/donson/momark/util/b/a;->w:Z

    return-void
.end method

.method public static a()Lcom/donson/momark/util/b/a;
    .locals 2

    sget-object v0, Lcom/donson/momark/util/b/a;->b:Lcom/donson/momark/util/b/a;

    if-nez v0, :cond_1

    const-class v0, Lcom/donson/momark/util/b/a;

    monitor-enter v0

    :try_start_0
    sget-object v1, Lcom/donson/momark/util/b/a;->b:Lcom/donson/momark/util/b/a;

    if-nez v1, :cond_0

    new-instance v1, Lcom/donson/momark/util/b/a;

    invoke-direct {v1}, Lcom/donson/momark/util/b/a;-><init>()V

    sput-object v1, Lcom/donson/momark/util/b/a;->b:Lcom/donson/momark/util/b/a;

    :cond_0
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_1
    sget-object v0, Lcom/donson/momark/util/b/a;->b:Lcom/donson/momark/util/b/a;

    return-object v0

    :catchall_0
    move-exception v1

    :try_start_1
    monitor-exit v0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v1
.end method

.method private d()Z
    .locals 4

    const/4 v3, 0x0

    iget-object v0, p0, Lcom/donson/momark/util/b/a;->e:Landroid/content/Context;

    const-string v1, "activity"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    iget-object v1, p0, Lcom/donson/momark/util/b/a;->e:Landroid/content/Context;

    invoke-static {v1}, Lcom/donson/momark/a/o;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "android.permission.GET_TASKS"

    invoke-virtual {v1, v2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_2

    const/4 v1, 0x2

    invoke-virtual {v0, v1}, Landroid/app/ActivityManager;->getRunningTasks(I)Ljava/util/List;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v1

    if-eqz v1, :cond_1

    :cond_0
    move v0, v3

    :goto_0
    return v0

    :cond_1
    invoke-interface {v0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager$RunningTaskInfo;

    iget-object v0, v0, Landroid/app/ActivityManager$RunningTaskInfo;->topActivity:Landroid/content/ComponentName;

    invoke-virtual {v0}, Landroid/content/ComponentName;->getClassName()Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/donson/momark/util/b/a;->e:Landroid/content/Context;

    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Class;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v0

    const/4 v1, -0x1

    if-le v0, v1, :cond_2

    const/4 v0, 0x1

    goto :goto_0

    :cond_2
    move v0, v3

    goto :goto_0
.end method


# virtual methods
.method public a(Landroid/content/Context;Lcom/donson/momark/view/view/AdView;)Lcom/donson/momark/util/b/a;
    .locals 1

    iput-object p1, p0, Lcom/donson/momark/util/b/a;->e:Landroid/content/Context;

    iput-object p2, p0, Lcom/donson/momark/util/b/a;->h:Lcom/donson/momark/view/view/AdView;

    sget-object v0, Lcom/donson/momark/util/b/a;->j:Ljava/util/Map;

    invoke-interface {v0, p1, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/donson/momark/util/b/a;->w:Z

    const-string v0, "activity"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    iput-object v0, p0, Lcom/donson/momark/util/b/a;->d:Landroid/app/ActivityManager;

    const-string v0, "keyguard"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/KeyguardManager;

    iput-object v0, p0, Lcom/donson/momark/util/b/a;->a:Landroid/app/KeyguardManager;

    sget-object v0, Lcom/donson/momark/util/b/a;->b:Lcom/donson/momark/util/b/a;

    return-object v0
.end method

.method public run()V
    .locals 2

    :cond_0
    :goto_0
    iget-boolean v0, p0, Lcom/donson/momark/util/b/a;->w:Z

    if-nez v0, :cond_1

    return-void

    :cond_1
    invoke-direct {p0}, Lcom/donson/momark/util/b/a;->d()Z

    move-result v0

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/donson/momark/util/b/a;->e:Landroid/content/Context;

    invoke-static {v0}, Lcom/donson/momark/b/a;->a(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/donson/momark/util/b/a;->a:Landroid/app/KeyguardManager;

    invoke-virtual {v0}, Landroid/app/KeyguardManager;->inKeyguardRestrictedInputMode()Z

    move-result v0

    if-nez v0, :cond_2

    iget-object v0, p0, Lcom/donson/momark/util/b/a;->h:Lcom/donson/momark/view/view/AdView;

    invoke-virtual {v0}, Lcom/donson/momark/view/view/AdView;->sendCommand()Lcom/donson/momark/a/r;

    move-result-object v0

    iput-object v0, p0, Lcom/donson/momark/util/b/a;->g:Lcom/donson/momark/a/r;

    :cond_2
    :try_start_0
    iget-object v0, p0, Lcom/donson/momark/util/b/a;->g:Lcom/donson/momark/a/r;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/donson/momark/util/b/a;->g:Lcom/donson/momark/a/r;

    iget-object v0, v0, Lcom/donson/momark/a/r;->d:Lcom/donson/momark/a/a/u;

    invoke-virtual {v0}, Lcom/donson/momark/a/a/u;->a()I

    move-result v0

    mul-int/lit16 v0, v0, 0x3e8

    int-to-long v0, v0

    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    const-string v1, "refreshThread interruptedException."

    invoke-static {v1, v0}, Lcom/donson/momark/util/t;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0
.end method
